import 'package:aio/aio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:app/generated/app_strings.dart';
import 'package:app/src/http/bean/wroks/attachment_bean.dart';
import 'package:app/src/http/bean/wroks/contract_bean.dart';
import 'package:app/src/http/bean/wroks/customers_copyInfo.dart';
import 'package:app/src/ui/app_ui.dart';
import 'package:app/src/ui/route/works/public/items/ui_base.dart';
import 'package:app/src/ui/route/works/public/items/ui_card.dart';
import 'package:app/src/utils/image_path_utils.dart';

///工艺路线
class UiProcessList {
  ///title 标题
  static Widget build(BuildContext context, List<List<String>>? data) {
    // List<List<String>>? data = [];
    // for (int i = 0; i < 5; i++) {
    //   List<String>? data2 = [];
    //   for (int j = 0; j < 20; j++) {
    //     data2.add("测试" + j.toString());
    //   }
    //   data.add(data2);
    // }
    var title = AppStrings.of(context).ProcessList; //工艺路线
    List<Widget> children0 = [];
    children0.add(UiBase.title(context, title, bottom: 4));
    List<Widget> children = [];
    data?.forEach((element) {
      List<Widget> children1 = [];
      var index = 0;
      var length = element.length;
      element.forEach((element) {
        children1.add(_text(element));
        index++;
        if (index < length) {
          children1.add(Icon(
            Icons.arrow_forward_sharp,
            size: 12,
          ));
        }
      });
      Row row = Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: children1,
      );
      children.add(row);
    });
    var column = Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: children,
    );
    SingleChildScrollView singleChildScrollView = SingleChildScrollView(
      physics: BouncingScrollPhysics(),
      child: column,
      scrollDirection: Axis.horizontal,
    );
    children0.add(singleChildScrollView);
    var column2 = Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: children0,
    );
    var card = UiCard.build(context, column2);
    return card;
  }

  static Widget _text(String? text) {
    TextStyle? style = AppStyle.textStyleWithCardWhite();
    return Container(
      child: Text(
        text ?? "",
        style: style,
      ),
      margin: EdgeInsets.symmetric(vertical: 4),
      padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
      decoration: BoxDecoration(
          color: Colors.orange,
          borderRadius: BorderRadius.all(Radius.circular(10.0))),
    );
  }
}
